package api

import (
	"api/basic/config"
	"api/basic/proto/user"
	"api/handler/request"
	"github.com/gin-gonic/gin"
	"log"
)

func Login(c *gin.Context) {
	var data request.UserLoginReq
	err := c.ShouldBind(&data)
	if err != nil {
		return
	}

	r, err := config.User.UserLogin(c, &user.UserLoginReq{
		Name:     data.Name,
		Password: data.Password,
	})
	if err != nil {
		log.Fatalf("could not greet: %v", err)
	}
	log.Printf("Greeting: %s", r)
}
